<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>父传子</title>
</head>
<body>

<div id="app">
  <menu-item></menu-item>
  <menu-item :p-obj="pobj"></menu-item>
</div>

<script src="../lib/vue.js"></script>
<script>
  Vue.component('menu-item', {
    props: {
      pObj: {
        type: Object,
        default: function () {
          return {
            username: 'zhangsan',
            age: 18
          }
        }
      }
    },
    template: `
      <div>
        <div>{{typeof pObj}} : {{pObj}}</div>
      </div>`
  })

  let vm = new Vue({
    el: '#app',
    data: {
      pobj: {
        username: 'lisi',
        age: 20
      },
    }
  })
</script>

</body>
</html>